// d.cpp : Defines the entry point for the console application.
//


#include <iostream>
#include <string>
using namespace std;
const int N = 10000;
int main(){

	int n,i,k=0;
	std::ios_base::sync_with_stdio(false);
	float j,pW,vW[N],pF[N],vF[N],th[N],costF[N],costW,totalF=0,min=1000000000,v;
	while(cin>>n){
		if(n==0)return 0;
		min=1000000000;
		totalF=k=0;
	cin>>pW;
	for (i=0;i<n;i++)
	{
		cin>>vW[i]>>pF[i]>>vF[i]>>th[i];
		if (th[i]<0)k++;
	}
	if(k==n){cout<<"0"<<endl;}else {
	for (j=0.0;j<10;j+=0.01)
	{
		costW=j*pW;
		totalF=0;
		for (i=0;i<n;i++)
		{
			v=j*vW[i];
			if ((th[i]-v)<0)costF[i]=0;
			else{
				double X =th[i]-v;
				double Y = vF[i];
				costF[i]=X/Y * pF[i];
			}
			//cout<<"vW="<<v<<" vF="<<th[i]-v<<" costW="<<costW<<" costF="<<costF[i]<<endl;
			//system("pause");
			
		}
		for (i=0;i<n;i++)
			totalF+=costF[i];
		
		if (costW+totalF<min && costW+totalF>0)
			min=costW+totalF;
		//cout<<" TOTAL="<<costW+totalF<<endl;
		//cout<<"=================================================="<<endl;
	}
	cout<<min<<endl;}
	
	}
	return 0;
}

